﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SW2A311A
{
    public class ProductCounter
    {
        #region Instansvariabler
        internal Product Product { get; set; }

        internal int NumberOfProduct
        {
            get { return _numberOfProduct; }
            set
            {
                if (value > 0)
                    _numberOfProduct = value;
                else
                    throw new ArgumentOutOfRangeException("NumberOfProduct", "Skal være positivt tal");
            }
        }
        private int _numberOfProduct;
        #endregion

        #region Constructors
        public ProductCounter(Product incomingProduct, int incomingNumberOfProduct)
        {
            Product = incomingProduct;
            NumberOfProduct = incomingNumberOfProduct;
        }
        #endregion

        #region Metoder
        public override string ToString()
        {
            return string.Format("{0} stk á {1}", NumberOfProduct, Product.ToString());
        }
        #endregion
    }
}
